package com.qf.api.sys.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qf.core.annotation.ExcelColumn;
import com.qf.core.annotation.ExcelSheet;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @Author: sin
 * @Date: 2025/5/21 20:53
 * @Description:
 **/
@TableName(value = "sys_login_log")
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Builder
@ExcelSheet(name = "登录日志")
public class SysLoginLogEntity implements Serializable {
    /**
     * 序列化
     */

    @TableId(value = "id", type = IdType.AUTO)
    @ExcelColumn(name = "ID", order = 0)
    private Long id;

    @ExcelColumn(name = "用户名", order = 1)
    private String username;

    @ExcelColumn(name = "登录IP", order = 2)
    private String ipAddress;

    @ExcelColumn(name = "登录地点", order = 3)
    private String loginLocation;

    @ExcelColumn(name = "浏览器", order = 5)
    private String browser;

    @ExcelColumn(name = "操作系统", order = 4)
    private String operationSystem;

    /**
     * 状态((1:成功;0:失败))
     */
    @TableField(value = "status")
    @ExcelColumn(name = "响应状态", order = 6)
    private Integer status;

    private String msg;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(fill = FieldFill.INSERT, value = "login_time")
    @ExcelColumn(name = "登录时间", order = 7)
    private Date loginTime;

    /**
     * 逻辑删除标识(0:未删除;1:已删除)
     **/
    @TableField(value = "deleted")
    @TableLogic
    private Boolean deleted;
}